package com.damn;
import org.apache.tomcat.jni.File;

import com.google.code.facebookapi.*; 



public class FBPoster {	

	  public final static String FACEBOOK_API_KEY = "348522271861961";  
	  public final static String FACEBOOK_API_SECRET = "4c467505178afb83648674e5727c60e3";
	  public final static String SESSION_KEY = "8285dc68ac8c5f5dc6ee632f.0-100003745872847";
	  
	  // Replace the User Id with the Admin User Id of the Facebook Page  
	  public final static String USER_ID = "100003745872847";  
	  
	  // Replace the Facebook Page Id - if you don't know your Facebook Page Id this link  
	  // will tell you how to find it: http://support.wibiya.com/entries/187061-how-to-find-your-facebook-fan-page-id  
	  public final static String FACEBOOK_PAGE_ID = "100003745872847";  
	  public final static String FACEBOOK_ACCESS_TOKEN = "AAAE8ZBqo17MkBAAJXypL0LpklchvUVA5yM6GQfpaScoEdcSDucm1YYu3BMeZAFAeLZCZCjZBlA5ZAauDszm2MXvCv15SnziYZCXrlZAaP1rUywZDZD";
	  
	  public void myFirstPost() throws Exception {  
		
	    // First we create the client with the API Key/Secret and Session Key  
	    FacebookJsonRestClient client = new FacebookJsonRestClient(FACEBOOK_API_KEY, FACEBOOK_API_SECRET, FACEBOOK_ACCESS_TOKEN);
	    //File photo = new File("F:\\Photo\\Dhaval\\Wallpapers\\75Gamewallpapers\\Alone in The Dark.jpg");
	   //String Session_key = client.auth_getSession(FACEBOOK_ACCESS_TOKEN);
	   //System.out.println(Session_key);
	    // Image attachment to make our first post more eye catching (note: you can add as many images as you like)  
	    Attachment attachment = new Attachment();  
	    // The first URL is the image URL, the second is the URL that the user is taken to when they click the image  
	    attachment.addMedia(  
	      new AttachmentMediaImage(  
	        "http://free.hostingjava.it/-mehtadhaval/m1.jpg",  
	        "http://free.hostingjava.it/-mehtadhaval/m2.jpg"));  
	  
	    // Post your first post!  
	    client.stream_publish(  
	      "Test Post From FBAuto - By Dhaval....",  
	      attachment, null, new Long(FACEBOOK_PAGE_ID), new Long(USER_ID));  
}
}
